//this class use qt library thread to implement threadimpl interface
//andycai_sc 2011-05-29

#ifndef QTTHREADIMPL_H
#define QTTHREADIMPL_H

#include "GParallel/GThreadImpl.h"
#include <QThread>

class QtThreadImpl : public GThreadImpl
{
public:
    QtThreadImpl(GThread* thread);
    virtual ~QtThreadImpl();

    void startImpl();
    void stopImpl();
    void joinImpl();
    void sleepImpl(long mseconds);

private:
    class RunableThread : public QThread
    {
    public:
        RunableThread(GThreadImpl* threadImpl, QObject* parent = 0);

        static void millsleep(long mseconds);

    private:
        void run();

        GThreadImpl* m_threadImpl;
    };

    RunableThread* m_runableThread;
};

#endif
